package org.softmed.rest.generation.xml.manager;

import java.util.HashMap;
import java.util.Map;
import org.softmed.persistence.PersistenceManager;
import org.softmed.rest.config.Application;
import org.softmed.rest.generation.xml.XMLObjectEdit;
import org.softmed.rest.generation.xml.XMLUnmarshaller;

public class ProcessObjectEdit {

	static Map<String, XMLObjectEdit> unmarshallers = new HashMap<String, XMLObjectEdit>();

	XMLObjectEdit unmarshaller;

	public ProcessObjectEdit(String choice) {
		unmarshaller = unmarshallers.get(choice);
		if (unmarshaller != null)
			unmarshaller = unmarshaller.clone();
	}

	public Object fromXML(Class type, String id, String xml,
			PersistenceManager util, Application app) throws Throwable {
		return unmarshaller.fromXML(xml, id, type, util, app);
	}

	public static Map<String, XMLObjectEdit> getUnmarshallers() {
		return unmarshallers;
	}

}
